package com.dp.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "t_subject")
//@NamedQueries({@NamedQuery(name = "TSubject.findAll", query = "SELECT t FROM TSubject t"), @NamedQuery(name = "TSubject.findByContentid", query = "SELECT t FROM TSubject t WHERE t.contentid = :contentid")})
public class TSubject implements Serializable{
	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@Column(name = "contentid")
	private String contentid;                    //内容id
	@Basic(optional = false)
	@Column(name = "user_id")                    //所属cp   
	private String userid;
	@Basic(optional = false)
	@Column(name = "service_code")               //业务代码
	private String serviceCode;
	@JoinColumn(name = "genre_id", referencedColumnName = "genre_id")   
	@ManyToOne
	private TGenre tgenre;                       //风格
	@Column(name = "itemid")
	private String itemid;
	@Basic(optional = false)
	@Column(name = "content_name")               //内容名称
	private String contentName;
	@Column(name = "content_keyword")            //关键字
	private String contentKeyword;
	@Column(name = "content_pubdate")          
	@Temporal(TemporalType.TIMESTAMP)
	private Date contentPubdate;                 //发布日期  
	@Column(name = "conten_info")               
	private String contenInfo;                  //内容介绍 
	@Basic(optional = false)
	@Column(name = "content_type")               
	private String contentType;                  //内容类型： 1 图片 2 音频 3游戏 4电子书 5电子书客户端 6电子书支持 7铃音盒 8主题 9视频 10软件
	@Column(name = "content_updateddate")
	@Temporal(TemporalType.TIMESTAMP)
	private Date contentUpdateddate;             //更新时间
	@Column(name = "Copyright_deadline")
	@Temporal(TemporalType.TIMESTAMP)
	private Date CopyrightDeadline;              //版权截止时间
	@Basic(optional = false)
	@Column(name = "content_status")
	private String contentStatus;                //审核状态 
	@Column(name = "unpasscause")
	private String unpassCause;                  //未通过原因
	@Column(name = "audituser")
	private String audituser;                    //审核人
	@Column(name = "pub_company")
	private String pubCompany;                   //发行公司
	@OneToMany(fetch = FetchType.EAGER,mappedBy = "contentid")
    private Set<TSubjectResources> tsubjectResources;
	public TSubject(){
	}
    public TSubject(String contentid){
		this.contentid=contentid;
	}
    public TSubject(String contentid,String userid,String serviceCode,String content_name,String contentType,String content_status){
		this.contentid=contentid;
	}
    
	public String getContentid() {
		return contentid;
	}
	public void setContentid(String contentid) {
		this.contentid = contentid;
	}
	public String getUserid() {
		return userid;
	}
	public void setUserid(String userid) {
		this.userid = userid;
	}
	public String getServiceCode() {
		return serviceCode;
	}
	public void setServiceCode(String serviceCode) {
		this.serviceCode = serviceCode;
	}
	
	public TGenre getTgenre() {
		return tgenre;
	}
	public void setTgenre(TGenre tgenre) {
		this.tgenre = tgenre;
	}
	public String getItemid() {
		return itemid;
	}
	public void setItemid(String itemid) {
		this.itemid = itemid;
	}
	public String getContentName() {
		return contentName;
	}
	public void setContentName(String contentName) {
		this.contentName = contentName;
	}
	public String getContentKeyword() {
		return contentKeyword;
	}
	public void setContentKeyword(String contentKeyword) {
		this.contentKeyword = contentKeyword;
	}
	public Date getContentPubdate() {
		return contentPubdate;
	}
	public void setContentPubdate(Date contentPubdate) {
		this.contentPubdate = contentPubdate;
	}
	public String getContenInfo() {
		return contenInfo;
	}
	public void setContenInfo(String contenInfo) {
		this.contenInfo = contenInfo;
	}
	public String getContentType() {
		return contentType;
	}
	public void setContentType(String contentType) {
		this.contentType = contentType;
	}
	public Date getContentUpdateddate() {
		return contentUpdateddate;
	}
	public void setContentUpdateddate(Date contentUpdateddate) {
		this.contentUpdateddate = contentUpdateddate;
	}
	public Date getCopyrightDeadline() {
		return CopyrightDeadline;
	}
	public void setCopyrightDeadline(Date copyrightDeadline) {
		CopyrightDeadline = copyrightDeadline;
	}
	public String getContentStatus() {
		return contentStatus;
	}
	public void setContentStatus(String contentStatus) {
		this.contentStatus = contentStatus;
	}
	
	public String getUnpassCause() {
		return unpassCause;
	}
	public void setUnpassCause(String unpassCause) {
		this.unpassCause = unpassCause;
	}
	public String getAudituser() {
		return audituser;
	}
	public void setAudituser(String audituser) {
		this.audituser = audituser;
	}
	public String getPubCompany() {
		return pubCompany;
	}
	public void setPubCompany(String pubCompany) {
		this.pubCompany = pubCompany;
	}
	
	public Set<TSubjectResources> getTsubjectResources() {
		return tsubjectResources;
	}
	public void setTsubjectResources(Set<TSubjectResources> tsubjectResources) {
		this.tsubjectResources = tsubjectResources;
	}
	
	@Override
	public int hashCode() {
	        int hash = 0;
	        hash += (contentid != null ? contentid.hashCode() : 0);
	        return hash;
	}

    @Override
	public boolean equals(Object object) {
	    if (!(object instanceof TSubject)) {
	          return false;
	     }
	    TSubject other = (TSubject) object;
	     if ((this.contentid == null && other.contentid != null) || (this.contentid != null && !this.contentid.equals(other.contentid))) {
	         return false;
	     }
	     return true;
	}
	    
	@Override
    public String toString() {
        return "com.dp.vo.TSubject[contentid=" + contentid + "]";
    }
	
}
